CXX=g++
CXXFLAGS= -Wall  -std=c++14 -pthread
DEBUG ?= 0
ifeq ($(DEBUG),1)
	CXXFLAGS+= -g -DDEBUG
endif

SRCS=main.cpp  TcpServer.cpp ThreadPool.cpp Buffer.cpp Channel.cpp Dispatcher.cpp EpollDispatcher.cpp EventLoop.cpp WorkerThread.cpp TcpConnection.cpp CData.cpp ChatTask.cpp LoginTask.cpp FriendTask.cpp TaskFactory.cpp user.cpp BaseTask.cpp sem.cpp SharedMemoryIPC.cpp
OBJS=$(SRCS:.cpp=.o)

EXEC=server 

all:$(EXEC)

$(EXEC):$(OBJS)
	$(CXX) $(CXXFLAGS) -o $@ $^

%.o:%.cpp %.h
	$(CXX) $(CXXFLAGS) -c $< -o $@

clean:
	rm -rf $(OBJS)